from PyQt5 import QtCore
from PyQt5.QtWidgets import QApplication, QWidget
from ui_test2 import Ui_Form
from pgtools.plugins.client.qtwidget_helper import TMediaPlayer
from os.path import dirname, join


class MyTest(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.ui = Ui_Form()
        self.ui.setupUi(self)
        self.m = TMediaPlayer(join(dirname(__file__), 'res', '30s.mp3'))

    def on_pushButton_pressed(self):
        self.m.play()

    def on_pushButton_released(self):
        self.m.pause()

    def on_pushButton_2_pressed(self):
        self.m.stop()

    def on_pushButton_2_released(self):
        self.m.play()


app = QApplication([])
test = MyTest()
test.show()
app.exec_()
